package com.szh.zx.duoxiancheng.chapter1;

public class TestLamdba {
	//	2.变成静态内部类
	static class Like2 implements Ilike {

		@Override
		public void like() {
			System.out.println(" i like2");
		}
	}

	public static void main(String[] args) {
//	3.局部内部类
		class Like3 implements Ilike {

			@Override
			public void like() {
				System.out.println(" i like3");
			}
		}
//		最初的
		Ilike ilike = new Like();
		ilike.like();

		ilike = new Like2();
		ilike.like();
		ilike = new Like3();
		ilike.like();
//		4. 匿名内部类
		ilike= new Ilike() {
			@Override
			public void like() {
				System.out.println(" i like4");
			}
		};
		ilike.like();
//	5. lambda
		ilike=() -> System.out.println("i like 5");
		ilike.like();
	}
}

interface Ilike {
	abstract void like();
}

class Like implements Ilike {

	@Override
	public void like() {
		System.out.println(" i like");
	}
}